package com.atguigu.yygh.hosp.service.impl;

import com.atguigu.yygh.common.handler.YyghException;
import com.atguigu.yygh.hosp.mapper.HospitalSetMapper;
import com.atguigu.yygh.hosp.service.HospitalSetService;
import com.atguigu.yygh.model.hosp.HospitalSet;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class HospitalSetServiceImpl
        extends ServiceImpl<HospitalSetMapper, HospitalSet>
        implements HospitalSetService {



    //获取验证信息hoscode
    @Override
    public String getSignKey(String hoscode) {

        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("hoscode",hoscode);
        HospitalSet hospitalSet = baseMapper.selectOne(wrapper);
        if(hospitalSet==null){
            //没有次医院信息
            throw new YyghException(20001,"获取医院信息异常");
        }

            String signKey = hospitalSet.getSignKey();
            return signKey;
    }
}

